<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
    session.setAttribute("basePath", basePath);
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加员工</title>
    <script type="text/javascript" src="${basePath }js/jquery-2.1.4.js"></script>
    <script type="text/javascript" src="${basePath }js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="${basePath }css/bootstrap.min.css">
</head>
<script type="text/javascript">
    function check() {
        var flag = true;
        var pic = document.getElementById("userPhotoPath").value;
        var admin = document.getElementById("userId").value;
        var name = document.getElementById("userName").value;
        var password1 = document.getElementById("userPassword1").value;
        var password2 = document.getElementById("userPassword2").value;
        if ("" == admin) {
            alert("请输入账号！");
            flag = false;
            return false;
        } else if ("" == name) {
            alert("请输入姓名！");
            flag = false;
            return false;
        } else if ("" == password1) {
            alert("请输入密码！");
            flag = false;
            return false;
        } else if ("" == password2) {
            alert("请再次输入密码！");
            flag = false;
            return false;
        }
        if (flag == true) {
            //form.submit();
            return true;
        }
    }
        //校验确认密码
        function checkPwd(){
            //获取第一次校验密码
            var pwd=document.getElementById("userPassword1").value;
            //获取确认密码
            var pwd2=document.getElementById("userPassword2").value;
            //获取span对象
            var span=document.getElementById("pwd2Span");
            //比较前两次密码是否相同
            if( pwd2==""|| pwd2==null){
                //输入校验结果
                span.innerHTML="*密码不能为空";
                span.style.color="red";
                return false;
            }else if(pwd===pwd2){
                //输入校验结果
                span.innerHTML="*密码通过";
                span.style.color="green";
                return true;
            }else{
                //输入校验结果
                span.innerHTML="*密码不同，请重新输入"
                span.style.color="red";
                return false;
            }
        }
</script>
>>>>>>> 6303743fbd9cc40a24fdc42189cfe29598f1a18f
<body style="background-color:#F2F2F2;">
<!--顶部-->
<div style="float:top;height:60px;background-color: black;padding: 13px">
    <p style="margin-left: 160px;color: white;font-size: large">
        <img src="${basePath}img/icon.png">
        原地起飞 - 餐厅到店点餐系统</p>
</div>
<!--主体-->
<div class="row" style=" position: absolute;left:35%;margin-left:-100px;">
    <div style="margin-left:15px;height: 502px; background-color:#F2F2F2;">
        <h3 style="margin-left:60px;">请填写员工账户信息：</h3>
        <p style="margin-left:60px;">请在下面的表单中填写新增员工所使用的用户名及密码</p>
        <div style="height:95px;margin-top:15px;margin-left:60px;width: 660px;border-radius:5px;border:2px solid #FFD6CC;background-color: white">
            <div style="background-color:#FFD6CC;height:35px;padding:10px;">
                <p style="color:#881B00;font-size:13px">！注意事项</p>
            </div>
            <p style="margin: 8px;">本系统中用户名唯一，即不能使用系统中已经存在的用户名,两次输入的密码必须一致，否则系统拒绝添加用户，如果不在右边的界面中为用户选择自定义的头像，用户将拥有系统默认的头像图片。
            </p>
        </div>
        <form class="form-horizontal" style="margin:5px;padding: 10px" action="${basePath }user/doregister.do">
            <div class="form-group">
                <label class="col-sm-2 control-label">头 像:</label>
                <div class="col-sm-10">
                    <input type="file" name="userPhotoPath" class="form-control" id="userPhotoPath" style="width: 550px">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">用户名:</label>
                <div class="col-sm-10">
                    <input type="text" name="userId" class="form-control" id="userId"
                           placeholder="请输入新员工的用户名" required="required" style="width: 550px">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">姓 名:</label>
                <div class="col-sm-10">
                    <input type="text" name="userName" class="form-control" id="userName"
                           placeholder="请输入新员工的姓名" required="required" style="width: 550px">
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">密 码:</label>
                <div class="col-sm-10">
                    <input type="password" name="userPassword" class="form-control" id="userPassword"
                           placeholder="请输入新员工密码" required="required" style="width: 550px">
                    <span id="pwd2Span"></span>
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label" >确 认:</label>
                <div class="col-sm-10">
                    <input type="password" name="userPassword" class="form-control" id="userPassword2" onblur="checkPwd2()"
                           placeholder="请再次输入新员工密码" required="required" style="width: 550px">
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label">身 份:</label>
                <div class="col-sm-10">
                    <select style="height: 35px;width: 550px" class="btn btn-default" name="roleDO.roleId">
                        <option>--</option>
                        <c:forEach items="${roles }" var="role">
                            <option value="${role.roleId }">${role.roleName}</option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default" onclick="return check();" style="border:0px;background-color: #F79090;color: white;width:180px;margin-left:183px">添加用户</button>
                </div>
            </div>
        </form>
        <button class="btn btn-default" type="button" style="margin-left:320px;background-color: #F79090;border: 0px;width: 180px;">
            <a href="${basePath }/OrderSys/users/BrowseUser.jsp" style="color: white">返回餐厅管理界面>></a>
        </button>
    </div>
</div>
</body>
</html>